package cn.xiqi.cms.beans;

import cn.xiqi.cms.hibernate.DAO.AccountDAO;
import cn.xiqi.cms.hibernate.DAO.AccountDAOImpl;
import cn.xiqi.cms.hibernate.beans.Usrinfo;
import cn.xiqi.cms.hibernate.service.AccountService;
import cn.xiqi.cms.hibernate.service.AccountServiceImpl;

public class UserBean {
	private int userid;
	private int accountid;
	private String name;
	private String sex;
	private String depart;
	private String role;
	private String level;
	private String stat;
	
	public UserBean(Usrinfo record) {
		AccountDAO dao = new AccountDAOImpl();
		AccountService service = new AccountServiceImpl();
		
		service.setDao(dao);
		this.userid = record.getUsrID();
		this.accountid = service.getByUsr(this.userid).getAccountID();
		this.name = record.getName();
		this.sex = record.isSex()?"男":"女";
		this.depart = record.getDepart();
		//TODO 从数据字典中取值
		this.role = Integer.toString(record.getRoleID());
		//TODO 从数据字典中取值
		this.level = Integer.toString(record.getLevel());
		//TODO 从数据字典中取值
		this.stat = Integer.toString(record.getStat());
	}
	public int getUserid() {
		return userid;
	}
	public void setUserid(int userid) {
		this.userid = userid;
	}
	public int getAccountid() {
		return accountid;
	}
	public void setAccountid(int accountid) {
		this.accountid = accountid;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getDepart() {
		return depart;
	}
	public void setDepart(String depart) {
		this.depart = depart;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public String getStat() {
		return stat;
	}
	public void setStat(String stat) {
		this.stat = stat;
	}
}
